﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace DBSchemaService.Core
{
    public class EmailInfo
    {
        private string _emailAddressToSendTo;
        private string _emailDisplayName;
        private string _database; //sprocs
        private string _serverPath;
        private WorkItem _wi; //database
        private int _changeSetNumber;
        private bool _isStructure;

        public string EmailAddressToSendTo
        {
            get
            {
                return _emailAddressToSendTo;
            }
            set
            {
                _emailAddressToSendTo = value;
            }
        }

        public string EmailDisplayName
        {
            get
            {
                return _emailDisplayName;
            }
            set
            {
                _emailDisplayName = value;
            }
        }

        public string Database
        {
            get
            {
                return _database;
            }
            set
            {
                _database = value;
            }
        }

        public string ServerPath
        {
            get
            {
                return _serverPath;
            }
            set
            {
                _serverPath = value;
            }
        }

        public WorkItem Wi
        {
            get
            {
                return _wi;
            }
            set
            {
                _wi = value;
            }
        }

        public int ChangeSetNumber
        {
            get
            {
                return _changeSetNumber;
            }
            set
            {
                _changeSetNumber = value;
            }
        }

        public bool IsStructure
        {
            get
            {
                return _isStructure;
            }
            set
            {
                _isStructure = value;
            }
        }
        
        public EmailInfo(bool isStructure)
        {
            _isStructure = isStructure;
        }
        /// <summary>
        /// constructor is for sprocs
        /// </summary>
        /// <param name="emailAddressToSendTo"></param>
        /// <param name="emailDisplayName"></param>
        /// <param name="database"></param>
        /// <param name="_serverPath"></param>
        public EmailInfo(string emailAddressToSendTo, string emailDisplayName, string database, string serverPath, int changesetNumber)
        {
            _emailAddressToSendTo = emailAddressToSendTo;
            _emailDisplayName = emailDisplayName;
            _database = database;
            _serverPath = serverPath;
            _wi = null;
            _changeSetNumber = changesetNumber;
            _isStructure = false;
        }

        /// <summary>
        /// constructor is for structures
        /// </summary>
        /// <param name="emailAddressToSendTo"></param>
        /// <param name="emailDisplayName"></param>
        /// <param name="wi"></param>
        /// <param name="serverPath"></param>
        /// <param name="changesetNumber"></param>
        public EmailInfo(string emailAddressToSendTo, string emailDisplayName, WorkItem wi, string serverPath, int changesetNumber)
        {
            _emailAddressToSendTo = emailAddressToSendTo;
            _emailDisplayName = emailDisplayName;
            _wi = wi;
            _isStructure = true;
            _database = wi.Fields["Database"].Value.ToString();
            _serverPath = serverPath;
            _changeSetNumber = changesetNumber;
        }
    }
}
